{
	"extends": "next/core-web-vitals",
	"plugins": ["boundaries"],
	"settings": {
		"import/resolver": {
			"typescript": {
				"alwaysTryTypes": true
			}
		},

		"boundaries/include": ["src/**/*"],

		"boundaries/elements": [
			{
				"type": "app",
				"pattern": "app"
			},

			{
				"type": "widgets",
				"pattern": "widgets/*",
				"capture": ["widget"]
			},
			{
				"type": "features",
				"pattern": "features/*",
				"capture": ["feature"]
			},
			{
				"type": "entities",
				"pattern": "entities/*",
				"capture": ["entity"]
			},
			{
				"type": "shared",
				"pattern": "shared/*",
				"capture": ["segment"]
			}
		]
	},

	"rules": {
		"react-refresh/only-export-components": 0,
		"boundaries/entry-point": [
			2,
			{
				"default": "disallow",
				"rules": [
					{
						"target": [
							[
								"shared",
								{
									"segment": "lib"
								}
							]
						],
						"allow": "*.(ts|tsx)"
					},
					{
						"target": [
							[
								"shared",
								{
									"segment": "store"
								}
							]
						],
						"allow": "*.(ts|tsx)"
					},
					{
						"target": [
							[
								"shared",
								{
									"segment": "helpers"
								}
							]
						],
						"allow": "*.(ts|tsx)"
					},
					{
						"target": [
							[
								"shared",
								{
									"segment": "(ui|api)"
								}
							]
						],
						"allow": "**"
					},
					{
						"target": ["widgets", "features", "entities"],
						"allow": "index.(ts|tsx)"
					}
				]
			}
		],

		"boundaries/element-types": [
			2,
			{
				"default": "allow",
				"message": "${file.type} is not allowed to import (${dependency.type})",
				"rules": [
					{
						"from": ["shared"],
						"disallow": ["widgets", "features", "entities"],
						"message": "Shared module must not import upper layers (${dependency.type})"
					},
					{
						"from": ["entities"],
						"message": "Entity must not import upper layers (${dependency.type})",
						"disallow": ["widgets", "features"]
					},
					{
						"from": ["entities"],
						"message": "Entity must not import other entity",
						"disallow": [
							[
								"entities",
								{
									"entity": "!${entity}"
								}
							]
						]
					},
					{
						"from": ["features"],
						"message": "Feature must not import upper layers (${dependency.type})",
						"disallow": ["widgets"]
					},
					{
						"from": ["features"],
						"message": "Feature must not import other feature",
						"disallow": [
							[
								"features",
								{
									"feature": "!${feature}"
								}
							]
						]
					},
					{
						"from": ["widgets"],
						"message": "Widget must not import other widget",
						"disallow": [
							[
								"widgets",
								{
									"widget": "!${widget}"
								}
							]
						]
					}
				]
			}
		]
	}
}
